package com.yanqu.road.server.cmd.wingroom;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.wingroom.WingRoomProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.wingroom.WingRoomModule;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_WING_ROOM_PATRONS_VISIT_RECEIVE, desc = "接待门客拜访事件")
public class ReceiveUserVisitPatronsCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {

        ret = player.getModule(WingRoomModule.class).receiveVisit();

    }

    @Override
    public void sendData(GamePlayer player) {
        if(ret != 0){
            player.sendPacket(Protocol.U_WING_ROOM_PATRONS_VISIT_RECEIVE, WingRoomProto.ReceiveUserVisitPatronsRespMsg.newBuilder().setRet(ret));
        }
    }
}
